home *** CD-ROM | disk | FTP | other *** search
- property pDuration, pMovieTime, VideoSprite, horizontal, extentSprite, hiliteMember, normalMember, tracking, newLocH, newLocV, sending, dynamic, style, Addressee, name, notify_list, min, max, valrange, minScreen, maxScreen, currentScreenVal, extentlength, CurrentVal
-
- on getPropertyDescriptionList
- set description to [:]
- if the currentSpriteNum = 0 then
- set memdefault to 0
- else
- set memref to the member of sprite the currentSpriteNum
- set castLibNum to the castLibNum of memref
- set memdefault to member (the memberNum of member memref + 1) of castLib castLibNum
- end if
- addProp(description, #hiliteMember, [#default: memdefault, #format: #bitmap, #comment: "Pict for Down:"])
- addProp(description, #VideoSprite, [#default: the currentSpriteNum + 5, #format: #integer, #comment: "Video Sprite:"])
- addProp(description, #extentSprite, [#default: the currentSpriteNum - 5, #format: #integer, #comment: "Slder Constraint Sprite:"])
- addProp(description, #horizontal, [#default: 1, #format: #boolean, #comment: "Horizontal (if not vertical):"])
- addProp(description, #dynamic, [#default: 1, #format: #boolean, #comment: "Dynamic:"])
- return description
- end
-
- on getBehaviorDescription
- return "Video Control Slider"
- end
-
- on getAssocMembers
- set myPropList to [hiliteMember]
- return myPropList
- end
-
- on compute_val me
- set val to 0.0
- set val to float(the currentScreenVal of me) / float(the extentlength of me)
- set val to val * the valrange of me
- set val to val + the min of me
- return val
- end
-
- on send_the_val me, val
- set pMovieTime to val * pDuration
- set the movieTime of sprite VideoSprite to pMovieTime
- end
-
- on beginSprite me
- global movieMe
- set pDuration to the duration of sprite(VideoSprite)
- set the min of me to 0.0
- set the max of me to 1.0
- set the sending of me to 1
- set handle to the spriteNum of me
- set the tracking of me to 0
- set the newLocH of me to the locH of sprite handle
- set the newLocV of me to the locV of sprite handle
- if the horizontal of me then
- set the newLocV of me to the locV of sprite the extentSprite of me
- set the minScreen of me to the left of sprite the extentSprite of me
- set the maxScreen of me to the right of sprite the extentSprite of me
- else
- set the newLocH of me to the locH of sprite the extentSprite of me
- set the minScreen of me to the left of sprite the extentSprite of me
- set the maxScreen of me to the right of sprite the extentSprite of me
- end if
- puppetSprite(handle, 1)
- set the stretch of sprite handle to 0
- set the locH of sprite handle to the newLocH of me
- set the locV of sprite handle to the newLocV of me
- set the valrange of me to the max of me - the min of me
- set the extentlength of me to the maxScreen of me - the minScreen of me
- if the sending of me = 0 then
- set the dynamic of me to 0
- end if
- set the normalMember of me to the member of sprite the spriteNum of me
- set movieMe to the movieRate of sprite the VideoSprite of me
- end
-
- on endSprite me
- puppetSprite(the spriteNum of me, 0)
- end
-
- on exitFrame me
- if tracking then
- set handle to the spriteNum of me
- set extent to the extentSprite of me
- if the horizontal of me then
- set the newLocH of me to the mouseH
- set the newLocV of me to the locV of sprite extent
- if the newLocH of me < the left of sprite extent then
- set the newLocH of me to the left of sprite extent
- end if
- if the newLocH of me > the right of sprite extent then
- set the newLocH of me to the right of sprite extent
- end if
- set the currentScreenVal of me to the newLocH of me - the minScreen of me
- else
- set the newLocH of me to the locH of sprite extent
- set the newLocV of me to the mouseV
- if the newLocV of me < the top of sprite extent then
- set the newLocV of me to the top of sprite extent
- end if
- if the newLocV of me > the bottom of sprite extent then
- set the newLocV of me to the bottom of sprite extent
- end if
- set the currentScreenVal of me to the newLocV of me - the minScreen of me
- end if
- set the locH of sprite handle to the newLocH of me
- set the locV of sprite handle to the newLocV of me
- if the dynamic of me then
- send_the_val(me, compute_val(me))
- end if
- else
- set x to float(the movieTime of sprite VideoSprite) / float(pDuration)
- set handle to the spriteNum of me
- set extent to the extentSprite of me
- if the horizontal of me then
- set ScreenX to the left of sprite extent + (x * (the right of sprite extent - the left of sprite extent))
- set the newLocH of me to ScreenX
- set the newLocV of me to the locV of sprite extent
- if the newLocH of me < the left of sprite extent then
- set the newLocH of me to the left of sprite extent
- end if
- if the newLocH of me > the right of sprite extent then
- set the newLocH of me to the right of sprite extent
- end if
- set the currentScreenVal of me to the newLocH of me - the minScreen of me
- else
- set ScreenY to the top of sprite extent + (x * (the bottom of sprite extent - the top of sprite extent))
- set the newLocH of me to the locH of sprite extent
- set the newLocV of me to ScreenY
- if the newLocV of me < the top of sprite extent then
- set the newLocV of me to the top of sprite extent
- end if
- if the newLocV of me > the bottom of sprite extent then
- set the newLocV of me to the bottom of sprite extent
- end if
- set the currentScreenVal of me to the newLocV of me - the minScreen of me
- end if
- set the locH of sprite handle to the newLocH of me
- set the locV of sprite handle to the newLocV of me
- end if
- end
-
- on mouseDown me
- set tracking to 1
- set the member of sprite the spriteNum of me to member the hiliteMember of me
- end
-
- on mouseUp me
- set tracking to 0
- set the member of sprite the spriteNum of me to member the normalMember of me
- if the sending of me then
- set x to compute_val(me)
- send_the_val(me, x)
- end if
- end
-
- on mouseUpOutSide me
- set tracking to 0
- set the member of sprite the spriteNum of me to member the normalMember of me
- if the sending of me then
- set x to compute_val(me)
- send_the_val(me, x)
- end if
- end
-
- on mouseEnter me
- end
-
- on mouseLeave me
- end
-